

package classloading.domain;

import com.hazelcast.map.MapLoader;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

// used in DynamicConfigAdvancedTest
public class IntMapLoader implements MapLoader<Integer, Integer>, Serializable {
    @Override
    public Integer load(Integer integer) {
        return integer;
    }

    @Override
    public Map<Integer, Integer> loadAll(Collection<Integer> collection) {
        Map<Integer, Integer> map = new HashMap<>();
        collection.forEach(value -> map.put(value, value));
        return map;
    }

    @Override
    public Iterable<Integer> loadAllKeys() {
        Collection<Integer> keys = IntStream.range(0, 10_000).boxed().collect(Collectors.toList());
        return keys;
    }
}
